package com.heima.kafka.listen;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

@Component //spring的主键注解
public class MessageListen {
    @KafkaListener(topics = "itcast-topic")//指定这个方法监听哪个主题
    public void handleMsg(ConsumerRecord<String,String> record){
        System.out.println("消息key=>"+record.key()+"消息的value"+record.value());
    }
}
